package com.example.springioc;

import com.example.springioc.component.UserComponent;
import com.example.springioc.config.UserConfig;
import com.example.springioc.controller.HelloController;
import com.example.springioc.controller.UController;
import com.example.springioc.model.UserInfo;
import com.example.springioc.repo.UserRepo;
import com.example.springioc.service.UserService;
import org.apache.catalina.util.Introspection;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.stereotype.Component;

import java.beans.Introspector;

//@ComponentScan(basePackages = {"com.example"})
@SpringBootApplication
public class SpringIocApplication {

    public static void main(String[] args) {
        ApplicationContext context =  SpringApplication.run(SpringIocApplication.class, args);
        HelloController bean = context.getBean(HelloController.class);
        System.out.println(bean);
        bean.sayHi();

//        HelloController bean = context.getBean(HelloController.class);
//        bean.sayHi();
//
//        HelloController helloController = (HelloController)context.getBean(("helloController"));
//        helloController.sayHi();
//
//        HelloController helloController1 = context.getBean("helloController", HelloController.class);
//        helloController1.sayHi();
//
//        UController bean = context.getBean(UController.class);
//        bean.sayHi();
//
//        UController uController = (UController)context.getBean(("UController"));
//        uController.sayHi();
//
//        UController uController1 = context.getBean("UController", UController.class);
//        uController1.sayHi();
//
//        System.out.println(Introspector.decapitalize("HelloController"));
//        System.out.println(Introspector.decapitalize("UController"));


//        UserService bean = context.getBean(UserService.class);
//        bean.deService();
//        UserComponent bean1 = context.getBean(UserComponent.class);
//        bean1.doComponent();
//
//        UserConfig bean3 = context.getBean(UserConfig.class);
//        bean3.doConfig();
//
//        UserRepo bean2 = context.getBean(UserRepo.class);
//        bean2.doRepo();

//        UserInfo bean = (UserInfo)context.getBean("USInfo");
//        System.out.println(bean);
    }

}
